const cardDefaultData = [{ value: '0', name: '社保卡' }, { value: '1', name: '公积金卡' }];
const exeCuteType = [{ value: '1', name: '绑定' }, { value: '2', name: '刷新' }, { value: '3', name: '激活' }
    , { value: '4', name: 'app留存操作' }, { value: '5', name: '解绑' }, { value: '7', name: '短信' }, { value: '8', name: '修改密码' }
    , { value: '9', name: '切换默认卡' }, { value: '10', name: '访问绑卡页面' }];

const exeCuteStatus = [{ value: '0', name: '成功' }, { value: '1', name: '失败' }, { value: '2', name: '获取城市绑卡信息' }
    , { value: '3', name: '点击注册' }, { value: '4', name: '点击修改' }, { value: '5', name: '点击登录参数说明' }, { value: '6', name: '获取城市注册信息' }
    , { value: '7', name: '获取城市修改密码信息' }, { value: '8', name: '点击注册参数说明' }, { value: '9', name: '点击修改密码参数说明' }]
function getValueByKey(arr, key) {
    let re;
    arr.forEach(function (item) {
        if (item.value == key) {
            re = item.name;
        }
    })
    return re;
}
const getSearchInputConfig = (cityList) => {
    return [
        {
            type: 'input',
            placeholder: '请输入用户ID',
            name: 'userId',
            label: '用户ID',
        },
        {
            type: 'select',
            placeholder: '请选择城市',
            name: 'cityCode',
            label: '全部城市',
            optionData: cityList,
            nameFiled: 'cityName',
            valueFiled: 'cityCode',
            selectProps: {
                allowClear: true,
            }
        },
        {
            type: 'select',
            placeholder: '请选择卡类型',
            name: 'gradType',
            label: '卡类型',
            optionData: cardDefaultData,
            selectProps: {
                allowClear: true,
            }
        },
        {
            type: 'select',
            placeholder: '请选择执行类型',
            name: 'busyType',
            label: '执行类型',
            optionData: exeCuteType,
            selectProps: {
                allowClear: true,
            }
        },
        {
            type: 'select',
            placeholder: '请选择执行状态',
            name: 'errorFlag',
            label: '执行状态',
            optionData: exeCuteStatus,
            selectProps: {
                allowClear: true,
            }
        },
        {
            type: 'input',
            placeholder: '请输入结果信息',
            name: 'errorMessage',
            label: '结果信息'
        },
    ]
};
const getTableConfig = () => {
    return [
        {
            title: '用户ID',
            dataIndex: 'userId',
            width: '10%'
        },
        {
            title: '城市',
            dataIndex: 'cityName',
            width: '10%',
        },
        {
            title: '账号',
            dataIndex: 'regNumber',
            width: '10%',
        },
        {
            title: '卡类型',
            dataIndex: 'gradType',
            render: text => { return getValueByKey(cardDefaultData, text) },
            width: '10%',
        },
        {
            title: '执行类型',
            dataIndex: 'busyType',
            width: '8%',
            render: text => { return getValueByKey(exeCuteType, text) },
        },
        {
            title: '执行状态',
            dataIndex: 'errorFlag',
            width: '8%',
            render: text => { return getValueByKey(exeCuteStatus, text) },
        },
        {
            title: '执行时间',
            dataIndex: 'createDate',
            width: '8%',
        },
        {
            title: '结果信息',
            dataIndex: 'errorMessage',
            width: '8%',
        }
    ];
}
export default {
    getSearchInputConfig,
    getTableConfig
}